function E = get_LSB_error(R, C, qtable)
    % calculate E in MME, e.g., error of change LSB
    % Input:
    % R -> C''- C' 
    % C -> C''
    % qtable -> unused
    % Output:
    % E -> Additional Distortion caused by changing any single bit
    %
    % Distortion function: D = 0.5 - E;
    %
    [P, Q] = size(C);
    E = ones(P, Q);
    RmC = R.*C;
    
    for i = 1:P
        for j = 1:Q
            if (RmC(i,j) <= 0) || (abs(C(i,j)) ~= 1)
                E(i,j) = 1 - 2*abs(R(i,j));
            end
        end
    end
    %min(E(:))
    %assert(min(E(:)) >= 0); %METHOD 3 will fail here.
end
